package main

import (
	"crypto/md5"
	"encoding/hex"
	"fmt"
)

func testSwitch(name string) {
	switch name {
	case "cui":
		fallthrough //在go语言的switch语句中如果想两个或任意多个case语句满足条件须在对应的条件上加上fallthrough选项
	case "cuimeng":
		fmt.Println("i am cui: ", name)
	default:
		fmt.Println("not found")
	}
}

type Calc func(a, b int) int

func Add(a, b int) int {
	return a + b
}
func CallFunc(a, b int, f Calc) int {
	return f(a, b)
}

func main() {
	testSwitch("cui")
	testSwitch("cuimeng")
	m := md5.New()
	m.Write([]byte("cuimeng"))
	res := hex.EncodeToString(m.Sum([]byte("")))
	fmt.Printf("%s len=%d\n", res, len(res))
	//ret, _ := hex.DecodeString(res)
	//fmt.Println(string(ret))
	fmt.Println(CallFunc(11, 22, Add))
}
